#include <pic18fregs.h>
#include "timer.h"

void timer_init() __naked{
	T1CON=0x1D;
	TMR1H=248;
	TMR1L=48; // OVF@1ms @16MHz
	
	__asm RETURN __endasm;
}
void timer_delayms(unsigned char t) __naked {
	while(t>0) {
		if(PIR1bits.TMR1IF!=0) { t--; PIR1bits.TMR1IF=0; }
	}
	__asm RETURN __endasm;
}

